package com.dragon.client.controller.avttendance;

import com.dragon.common.model.Insert;
import com.dragon.common.model.ResponseData;
import com.dragon.logical.service.avttendance.IQuartzJobService;
import com.dragon.repository.domain.vo.QuartzJobVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sy
 * @since 2023-07-17
 */
@RestController
@RequestMapping("quartzJob")
@Api(tags = "定时任务")
public class QuartzJobController {

    @Autowired
    IQuartzJobService service;

    @GetMapping("list")
    @ApiOperation("获取定时任务列表")
    public ResponseData getJobList(){
        service.getJobList();
        return ResponseData.success();
    }

    @PostMapping("add")
    @ApiOperation("添加")
    public ResponseData addJob( @RequestBody @Validated(Insert.class) QuartzJobVO vo){
        service.addJob(QuartzJobVO.convert(vo));
        return ResponseData.success();
    }

}
